#include <iostream>
#include <windows.h>
using namespace std;

#include "CUtilities.h"

RNGen *RNGEN = RNGen::GetInstance();

CMath *CMATH = CMath::GetInstance();

CConversion *CCONVERT = CConversion::GetInstance();

CTimer Timer;

CSystemAnalysis *CSYSTEM = CSystemAnalysis::GetInstance();

int Count = 250;

#define PRINT 1
#define COUNTTEST 0

int main()
{
	Timer.Initialize();

	CSYSTEM->Initialize();
	
	cout.precision(17);

	CSYSTEM->Update();

	cout << CSYSTEM->GetCpuUsage() << endl << CSYSTEM->GetMemUsage() << endl;

	double timestart = Timer.GetTimeSinceStart();

	Sleep(250);

#if 0

	double timestop = Timer.GetTimeSinceStart();

	Timer.AddWorkTime(timestop - timestart);

	cout << Timer.GetAverageWorkTime() << endl;

	Sleep(1250);

#endif

	

#if COUNTTEST

	Timer.Initialize();

	for(int i = 0; i < Count; i++)
	{
#if PRINT
		cout << RNGEN->Slow() << endl;
#endif
#if !PRINT
		RNGEN->Slow();
#endif
	}

	cout << Timer.GetTimeSinceStart() << endl;

	//////////////////////////////////////////////////////////

	cout << "Reset\n";

	Timer.Initialize();

	for(int i = 0; i < Count; i++)
	{
#if PRINT
		cout << RNGEN->FastMW() << endl;
#endif
#if !PRINT
		RNGEN->FastMW();
#endif
	}

	cout << Timer.GetTimeSinceStart() << endl;

	//////////////////////////////////////////////////////////
	
	cout << "Reset\n";

	Timer.Initialize();

	for(int i = 0; i < Count; i++)
	{
#if PRINT
		cout << RNGEN->FastW() << endl;
#endif
#if !PRINT
		RNGEN->FastW();
#endif
	}

	cout << Timer.GetTimeSinceStart() << endl;

	//////////////////////////////////////////////////////////
	
	cout << "Reset\n";

	Timer.Initialize();

	for(int i = 0; i < Count; i++)
	{
#if PRINT
		cout << RNGEN->FastI() << endl;
#endif
#if !PRINT
		RNGEN->FastI();
#endif
	}

	cout << Timer.GetTimeSinceStart() << endl;

	//////////////////////////////////////////////////////////

	cout << "Reset\n";

	Timer.Initialize();

	for(int i = 0; i < Count; i++)
	{
#if PRINT
		cout << RNGEN->FastSeed() << endl;
#endif
#if !PRINT
		RNGEN->FastSeed();
#endif
	}

	cout << Timer.GetTimeSinceStart() << endl;

	//////////////////////////////////////////////////////////

#endif


	for(int j=0; j<Count; j++)
	{
		cout << RNGEN->RandD(FASTSEED, 0.0, 1920.0) << endl;

		CSYSTEM->Update();
	}

	cout << CSYSTEM->GetCpuUsage() << endl << CSYSTEM->GetMemUsage() << endl;

	D3DXVECTOR3 temp1 = D3DXVECTOR3(1.0f, 0.0f, 1.0f);
	D3DXVECTOR3 temp2 = D3DXVECTOR3(0.0f, 1.0f, 0.0f);

	D3DXVECTOR3 Slerpee = CMATH->Slerp3D(temp1, temp2, 0.5);

	cout << Slerpee.x << " " << Slerpee.y << " " << Slerpee.z << endl;

	D3DXVECTOR2 Slerpee2 = CMATH->Slerp2D(D3DXVECTOR2(temp1), D3DXVECTOR2(temp2), 0.5f);

	cout << Slerpee2.x << " " << Slerpee2.y << endl;	

	CPathing Path;

	Path.AddWaypoint(D3DXVECTOR3(0.0f, 0.0f, 0.0f));
	Path.AddWaypoint(D3DXVECTOR3(1.0f, 0.0f, 0.0f));
	Path.AddWaypoint(D3DXVECTOR3(0.0f, 0.0f, 0.0f));
	Path.AddWaypoint(D3DXVECTOR3(0.0f, 1.0f, 0.0f));
	Path.AddWaypoint(D3DXVECTOR3(0.0f, 0.0f, 0.0f));
	Path.AddWaypoint(D3DXVECTOR3(0.0f, 0.0f, 1.0f));
	Path.AddWaypoint(D3DXVECTOR3(0.0f, 0.0f, 0.0f));

	cout << Path.CalculateDistance() << endl;

	cout << "---------------------------------------------------" << endl;

	cout << CCONVERT->FeetToMeter(100) << endl;
	cout << CCONVERT->FeetToMeter(CCONVERT->FeetToMeter(100),true) << endl;

	cout << CCONVERT->MeterToMile(1000) << endl;
	cout << CCONVERT->MeterToMile(CCONVERT->MeterToMile(1000),true) << endl;


	return 0;
};